﻿using System.Collections.Generic;
using Model;
using DBUtility;

/*
 * 作者:陈杰
 * QQ  :710782046
 * Email:ovenjackchain@gmail.com
 * Web :http://www.qidian10.com
 */
namespace DAO
{
    public class __usrcatDao
    {
        /// <summary>
        /// 获得所有记录
        /// </summary>
        /// <returns>返回所有记录IList</returns>
        public IList<__usrcat> FindAll___usrcat()
        {
            return Common<__usrcat>.Dt2List(DbHelperSQL.FindByConditions(new __usrcat(), ""));
        }
        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="start">起始记录号</param>
        /// <param name="limit">每页记录数</param>
        /// <param name="conditions">查询条件</param>
        /// <returns>返回符合记录的当前页数据</returns>
        public IList<__usrcat> FindAllByPage___usrcat(string start, string limit, string conditions)
        {
            return Common<__usrcat>.Dt2List(DbHelperSQL.FindByPage(new __usrcat(), start, limit, conditions));
        }

        /// <summary>
        /// 查找符合条件记录的总条数
        /// </summary>
        /// <param name="conditions">查询条件</param>
        /// <returns>返回符合的记录条数</returns>
        public string GetCount___usrcat(string conditions)
        {
            return DbHelperSQL.GetCountByConditions(new __usrcat(), conditions);
        }

        /// <summary>
        /// 根据id查找相应的一条记录
        /// </summary>
        /// <param name="id">要查找的ID号</param>
        /// <returns>返回值</returns>
        public __usrcat FindById___usrcat(int id)
        {
            __usrcat model = new __usrcat();
            return Common<__usrcat>.Dt2Model(model, DbHelperSQL.FindByConditions(model, " " + Common<object>.GetModelInfo(model)[1] + "=" + id.ToString()));
        }

        /// <summary>
        /// 添加新纪录
        /// </summary>
        /// <param name="__usrcat">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Add___usrcat(__usrcat ___usrcat)
        {
                return DbHelperSQL.Insert(___usrcat);
        }

        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="__usrcat">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Update___usrcat(__usrcat ___usrcat)
        {
                return DbHelperSQL.Update(___usrcat);
        }
        //批量更新
        public bool Update___usrcat(string sets,string conditions)
        {
                return DbHelperSQL.Update(new __usrcat(),sets,conditions);
        }
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="__usrcat">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Del___usrcat(__usrcat ___usrcat)
        {
                return DbHelperSQL.Delete(___usrcat);
        }
        //批量删除
        public bool Del___usrcat(string conditions)
        {
                return DbHelperSQL.Delete(new __usrcat(),conditions);
        }
        /// <summary>
        /// 根据条件查询记录
        /// </summary>
        /// <param name="conditions">条件</param>
        /// <returns>返回符合条件的IList</returns>
        public IList<__usrcat> FindByCondition___usrcat(string conditions)
        {
            return Common<__usrcat>.Dt2List(DbHelperSQL.FindByConditions(new __usrcat(), conditions));
        }
    }
}
